<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<div id="menuImpiegato">
		<ui:include src="/pagine_impiegati/commonHeader.xhtml" />
	</div>
</h:head>

<h:body>
	<h:form>
		<p:panel header="Form Creazione Volo">
			<h:panelGrid columns="3" id="voloGrid">

				<h:outputText value="Aeroporto Partenza" />
				<p:selectOneMenu id = "aeroportoPartenza" value="#{voloBean.volo.aeroportoPartenza}" 
					panelStyle="width:300px" effect="fade" var = "a"
					style="width:320px" filter="true" filterMatchMode="contains">
					<f:selectItem itemLabel="Digita un nome" itemValue="" />
					<f:selectItems value="#{aerBean.aeroporti}" var="aeroporto"
						itemLabel="#{aeroporto.nome} #{aeroporto.citta}" itemValue="#{aeroporto.codIata}" />
					<p:column>
					
					</p:column>  
                	  
            			
				</p:selectOneMenu>
				<p:message for = "aeroportoPartenza"/>
				
				

				<h:outputText value="Aeroporto Arrivo" />
				<p:selectOneMenu id = "aeroportoArrivo" value="#{voloBean.volo.aeroportoArrivo}" 
					panelStyle="width:300px" effect="fade" 
					style="width:320px" filter="true" filterMatchMode="contains">
					<f:selectItem itemLabel="Digita un nome" itemValue="" />
					<f:selectItems value="#{aerBean.aeroporti}" var="aeroporto"
						itemLabel="#{aeroporto.nome}" itemValue="#{aeroporto.codIata}" />
					<p:column>  
                		#{aeroporto.nome} - #{aeroporto.citta}  
            		</p:column>  		
				</p:selectOneMenu>
				<p:message for = "aeroportoArrivo"/>


				<h:outputLabel for="compagnia">Compagnia Aerea:</h:outputLabel>
				<p:inputText id="compagnia" value="#{voloBean.volo.compagnia}" />
				<p:message for="compagnia" />

				<h:outputLabel for="numVolo">Numero del volo:</h:outputLabel>
				<p:inputText id="numVolo" value="#{voloBean.volo.numVolo}" />
				<p:message for="numVolo" />
				
				<h:outputLabel for="prezzo" value="Prezzo: " />  
            		<p:spinner id="prezzo" value="#{voloBean.volo.prezzo}" min="1"/>
            	<p:message for="prezzo" />	  
				
				<h:outputLabel for="postiRimanenti" value="Posti Rimanenti: " />  
            		<p:spinner id="postiRimanenti" value="#{voloBean.volo.postiRimanenti}" min="1"/>  
				<p:message for="postiRimanenti" />
				
				<h:outputLabel for="data" value="Data: " />  
            		<p:calendar id="data" value="#{voloBean.volo.data}" />  
				<p:message for="data" />


			</h:panelGrid>
			<p:commandButton value="Conferma" action="#{voloBean.creaVolo()}" update="voloGrid" />
		</p:panel>
	</h:form>
</h:body>
</html>